<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>协同后台管理系统</title>
	<meta name="decorator" content="default"/>
	<link rel="stylesheet" href="${ctxStatic}/css/plugins/wangEditor/wangEditor.min.css">
	<link href="${ctxStatic}/css/plugins/datapicker/datepicker3.css" rel="stylesheet">
	<script src="${ctxStatic}/js/plugins/datapicker/bootstrap-datepicker.js"></script>
	<%@include file="/WEB-INF/views/include/treetable.jsp" %>
	<style>
		.datepicker.dropdown-menu{
			z-index: 20000;
		}
	</style>
	<script type="text/javascript">
        $(document).ready(function() {
          /*  $("#treeTable").treeTable({expandLevel : 3});*/
            $("#limitTime .input-daterange").datepicker({
                keyboardNavigation:false,
                forceParse:false,
                autoclose:true
            });
        });
	</script>
</head>
<body>
<div class="wrapper wrapper-content">
	<div class="row">
		<div class="col-sm-12">
		<div class="ibox float-e-margins">
			<%--<div class="ibox-title">
				<h5>创建资讯</h5>
			</div>--%>
			<div class="ibox-content">
				<form:form id="inputForm" modelAttribute="article" action="${ctx}/cms/article/save" method="post" class="form-horizontal">
					<form:hidden path="id"/>


					<div class="form-group"  style="margin-top: 50px;">
						<label class="col-sm-3 control-label">&nbsp;&nbsp;头像:</label>
						<div class="col-sm-8">
							<form:hidden id="image" path="image"  htmlEscape="false" maxlength="500" class="form-control"/>
							<sys:ckfinder input="image" type="thumb" uploadPath="/cms/article"  selectMultiple="false"/>
							<span style="font-size: 12px;color:#9b9b9b">你可以上传jpg, png格式的文件, 图片建议尺寸200x200px，文件大小不能超过2M。</span>
						</div>
					</div>


					<div class="form-group">
						<label class="col-sm-3 control-label"><span style="color: red;"><em>*</em></span>&nbsp;&nbsp;姓名:</label>
						<div class="col-sm-8">
							<form:input path="author" id="author"  htmlEscape="false" maxlength="200" required="true" class="form-control" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label"><span style="color: red;"><em>*</em></span>&nbsp;&nbsp;类目:</label>
						<div class="col-sm-8">
						<%--	<sys:treeselect id="category"  name="category.id" value="${article.category.id}" labelName="parent.name" labelValue="${article.category.name}"
											title="栏目" url="/cms/category/treeData?parentId=${parentId}" extId="${article.category.id}" cssClass=" form-control"/>--%>

							<sys:treeselect id="category"  name="category.id" value="${article.category.id}" labelName="parent.name" labelValue="${article.category.name}"
											title="栏目" url="/cms/category/treeData?parentId=${parentId}" extId="${article.category.id}" cssClass=" form-control"/>

						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label">头衔:</label>
						<div class="col-sm-8">
							<form:input path="title" id="title"  htmlEscape="false" maxlength="200"  class="form-control" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label">研究领域:</label>
						<div class="col-sm-8">
							<form:input path="articleData.researchField" id="researchField"  htmlEscape="false" maxlength="200"  class="form-control" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label">电话:</label>
						<div class="col-sm-8">
							<form:input path="articleData.phone" id="phone"  htmlEscape="false" maxlength="200"  class="form-control" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label">办公地址:</label>
						<div class="col-sm-8">
							<form:input path="articleData.address" id="address"  htmlEscape="false" maxlength="200"  class="form-control" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label">邮箱:</label>
						<div class="col-sm-8">
							<form:input path="articleData.email" id="email"  htmlEscape="false" maxlength="200"  class="form-control" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-sm-3 control-label"><span style="color: red;"><em>*</em></span>&nbsp;&nbsp;描述:</label>
						<div class="col-sm-8">
							<div id="richText"></div>
						</div>
						<form:hidden path="articleData.content" id="articleDataContent" />

					</div>

				<%--	<div class="form-group">
						<label class="col-sm-3 control-label"></label>
						<div class="col-sm-8" >
							<form:textarea path="articleData.content"  id="articleDataContent" cssStyle="width: 100%;height: 110px;"></form:textarea>
						</div>

					</div>--%>
					<div class="hr-line-dashed"></div>
					<div class="form-group" style="margin-top:30px">
						<div class="col-sm-8 col-sm-offset-3">
							<button style="margin-left: 100px;" type="button" class="btn btn-w-m btn-white" onclick="history.go(-1)">取消</button>
							<button  id="btnSubmit" type="button" class="btn btn-w-m btn-primary">确定</button>
						</div>
					</div>
				</form:form>
			</div>
		</div>
	</div>
	</div>
</div>
<script src="${ctxStatic}/js/plugins/wangEditor/wangEditor.min.js"></script>
<script src="${ctxStatic}/js/plugins/validate/jquery.validate.min.js"></script>
<script src="${ctxStatic}/js/plugins/validate/messages_zh.min.js"></script>
<script src="${ctxStatic}/js/idenger.form.js"></script>
<script type="text/javascript">
    var editor = formTools.initEditer();//初始化配置富文本编辑器
    //获取后台传过来的值
    var articleDataContent = $("#articleDataContent").val();
    editor.txt.html(articleDataContent);

    $("#btnSubmit").click(function(){
        $("#articleDataContent").val(editor.txt.html());
        if($("#author").val() == ""){
            prompt.alert("请填写名字");
            return;
        }
        if($("#categoryName").val()==""){
            prompt.alert("请选择类目");
            return;
		}
        $("#inputForm").submit();
    });
</script>
</body>
</html>